<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pe="http://primefaces.org/ui/extensions">

<ui:composition template="/templates/template.xhtml">

	<ui:define name="content">
		<h:form id="formPrincipal">
			<p:growl id="mensagens" life="#{msg.time_stick}" />

			<p:panel id="painel" >
				<f:facet name="header">
					<div align="left"><h:outputText value="Alertas do dia." styleClass="tituloPainelInterno"/></div>
				</f:facet>
				
				<p:dataTable styleClass="tabelaCompleta" value="#{notificacaoFaces.listaNotificacoes}" 
					var="item" 	emptyMessage="Não há alertas." 
					rowStyleClass="#{empty rowIx or rowIx mod 2 ne 0 ? 'even-row' : 'odd-row'}" rowIndexVar="rowIx"
					>
				
					<p:column headerText="Data retorno" width="15%">
						<h:outputText value="#{item.dataNotificacao}" >
							<f:convertDateTime pattern="#{msg.masc_dataComHora}" locale="#{msg.local_locale}" timeZone="#{msg.local_timezone}"/>
						</h:outputText>
					</p:column>
					
					<p:column headerText="Procedimento realizado">
						<p:commandLink actionListener="#{notificacaoFaces.exibirDetalhes(item.id)}" 
								update=":formPrincipal:dialogDetalhes" id="linkConsulta"> 
							<h:outputText value="#{item.procedimento}" />
						</p:commandLink>
						<p:tooltip for="linkConsulta" value="Exibir as informações inseridas no procedimento." styleClass="textoToolTip"/>
					</p:column>

					<p:column headerText="Nome animal">
						<h:outputText value="#{item.nomeAnimal}" />
					</p:column>

					<p:column headerText="Nome proprietário">
						 <h:outputText value="#{item.nomeProprietario}" /> 
					</p:column>

					
					<p:column headerText="Opções" width="5%">
							<p:commandLink styleClass="ui-icon ui-icon-pencil" 
									actionListener="#{notificacaoFaces.enviarEmail(item)}"
									update=":formPrincipal:mensagens :formPrincipal:painel"
									style="float:left;"
									id="enviarEmail"
							/>
							<p:tooltip for="enviarEmail" styleClass="textoToolTip">
								<h:outputText value="Enviar Email"/>
							</p:tooltip>
					</p:column>
					
				</p:dataTable>
			</p:panel>
			
			<p:dialog widgetVar="dialogDetalhes" header="Detalhes do procedimento." 
					id="dialogDetalhes" width="70%" modal="true" resizable="false" closeOnEscape="true">
				<table width="100%">
					<tr>
						<td valign="top" width="10%">
							<h:outputText value="Observações:" styleClass="areaCampos"/>
						</td>
						<td colspan="3">
							<h:outputText value="#{notificacaoFaces.detalheObservacoes}"/>
							<p:separator rendered="#{notificacaoFaces.temAnamnese}"></p:separator>
						</td>
					</tr>
					<tr>
						<td valign="top">
							<h:outputText value="Anamnese:" styleClass="areaCampos"
								rendered="#{notificacaoFaces.temAnamnese}" /></td>
						<td colspan="3">
							<h:outputText value="#{notificacaoFaces.detalheAnamnese}"/>
						</td>
					</tr>
				</table>
			</p:dialog>			

		</h:form>
	</ui:define>
</ui:composition>
</html>